@model OrchardCore.Users.ViewModels.ExternalLoginViewModel

@{ 
    ThemeLayout.Metadata.Alternates.Add("Layout__Login");
}

<form asp-controller="Account" asp-action="ExternalLoginConfirmation" asp-route-returnurl="@ViewData["ReturnUrl"]" asp-route-loginprovider="@ViewData["LoginProvider"]" method="post" class="form-horizontal">
    @if (Model.IsExistingUser)
    {
        <h4>@T["Link your account."]</h4>
        <p class="text-info">
            You've successfully authenticated with <strong>@ViewData["LoginProvider"]</strong>.
            You already have an account with this email address. Enter your local account password and click the @T["Register"] button
            to link the accounts and finish logging in.
        </p>
    }
    else
    {
        <h4>@T["Create a new account."]</h4>
        <p class="text-info">
            You've successfully authenticated with <strong>@ViewData["LoginProvider"]</strong>.
            Please enter an email address for this site below and click the @T["Register"] button to finish
            logging in.
        </p>
    }
    <hr />
    <div asp-validation-summary="All" class="text-danger"></div>
    <div class="form-group">
        <label asp-for="UserName" class="col-md-3 control-label">@T["Username"]</label>
        <div class="col-md-9">
            <input asp-for="UserName" class="form-control" autofocus disabled="@Model.IsExistingUser" />
            <span asp-validation-for="UserName" class="text-danger"></span>
        </div>
    </div>
    <div class="form-group">
        <label asp-for="Email" class="col-md-3 control-label">@T["Email"]</label>
        <div class="col-md-9">
            <input asp-for="Email" class="form-control" disabled="@Model.IsExistingUser" />
            <span asp-validation-for="Email" class="text-danger"></span>
        </div>
    </div>
    <div class="form-group">
        <label asp-for="Password" class="col-md-3 control-label">@T["Password"]</label>
        <div class="col-md-9">
            <input asp-for="Password" class="form-control" />
            <span asp-validation-for="Password" class="text-danger"></span>
        </div>
    </div>
    @Html.HiddenFor(m => m.IsExistingUser)
    @if (!Model.IsExistingUser)
    {
        <div class="form-group">
            <label asp-for="ConfirmPassword" class="col-md-3 control-label">@T["Confirm password"]</label>
            <div class="col-md-9">
                <input asp-for="ConfirmPassword" class="form-control" />
                <span asp-validation-for="ConfirmPassword" class="text-danger"></span>
            </div>
        </div>
    }
    else
    {
        @Html.HiddenFor(m => m.UserName)
        @Html.HiddenFor(m => m.Email)
    }

    <div class="form-group">
        <div class="col-md-offset-3 col-md-9">
            <button type="submit" class="btn btn-default">@T["Register"]</button>
        </div>
    </div>
</form>
